﻿using Management.Systeam.ErrorCode;
using Management.Systeam.Write.Api.Application.Command.Rolees;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Management.Systeam.Write.Api.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class RoleAllController : ControllerBase
{
        IMediator mediator;

        public RoleAllController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="AddRoleCommand"></param>
        /// <returns></returns>

        [HttpPost]
        public async Task<ApiResult<int>> AddRole(AddRoleCommand AddRoleCommand)
        {
            try
            {
                return await mediator.Send(AddRoleCommand);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
